<?php
	$cateModel = new \Common\Model\Category;
//	顶级分类
	$cateData = $cateModel->get();
	$cateData = Data::channelLevel($cateData, $pid = 0, $html = "&nbsp;", $fieldPri = 'cid', $fieldPid = 'pid', $level = 1);
	View::with('cateData',$cateData);
//	获得购物车中的数据
	/*session_unset();
	session_destroy();*/
	$cartData = Cart::getAllData();
	View::with('cartData',$cartData);
//	p($cartData);
?>
<script src="Public/Home/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
	var cart = "{{U('Cart/getCart')}}"
</script>
<!--头部公用模板-->
<div id="header">
	<!--顶部banner-->
	<div class="top_banner">
		<a class="block" href="#"></a>
	</div>
	<!--登陆注册导航栏-->
	<div class="top_nav">
		<div class="top_nav_con">
			<!--登陆注册导航左侧-->
			<ul class="top_nav_left fl">
				<li class="fl">
					<a class="block clicked" href="{{U('Index/index')}}">时尚商城</a>
				</li>
				<li class="fl seoul">
					<a class="block" href="">
						<span class="en">Seoul Station</span>
						<span class="zn">首 尔 站</span>
					</a>
				</li>
				<li class="phone fl">
					<a class="block" href="">
						<i class=""></i>
						手机优购
						<i class="tip"></i>
					</a>
					<div class="phone_con">
			          <p class="clearfix">
			            <span class="fl qr_code">
			            </span>
			            <span class="fl ml10">
			                <a class="btn_app_store btn" href="#" target="_blank">AppStore</a>
			                <a class="btn_android_store btn" href="#" target="_blank">Android</a>
			            </span>
			          </p>
			          <p class="fl qr_code_tip">下载安装 <strong>优购客户端</strong></p>
			        </div>
				</li>
			</ul>
			<!--登陆注册导航右侧-->
			<div class="top_nav_right fr">
				<div class="about_user fl">
					{{if value ="!isset($_SESSION['uid'])"}}
					<div class="no_login">
						<div class="login fl">
							<a href="{{U('Login/index')}}">登陆</a>
						</div>
						<div class="register fl">
							<a href="{{U('Reg/index')}}">注册</a>
						</div>
					</div>
					<!--登陆后-->
					{{else}}
					<div class="ok_login">
						<div class="username fl">
							您好！<span>{{$_SESSION['username']}}</span>
						</div>
						<div class="quit fl">
							<a href="{{U('Login/quit')}}">退出</a>
						</div>
					</div>
					{{endif}}
				</div>
				
				<div class="my_yg link_box hover">
					<a href="{{U('UserCenter/index')}}" class="my">我的优购</a>
					<ul class="info_con">
						<li><a href="#">我的收藏</a></li>
					</ul>
				</div>
				
				<div class="my_order link_box">
					<a href="#">我的订单</a>
				</div>
				
				<div class="notice link_box">
					<span class="notice_text">公告</span>
					<ul class="notice_con">
						<li><a href="#">公告1</a></li>
						<li><a href="#">公告2</a></li>
						<li><a href="#">公告3</a></li>
						<li><a href="#">公告4</a></li>
						<li><a href="#">公告5</a></li>
					</ul>
				</div>
				
				<div class="more link_box">
					<span class="more_text">更多</span>
					<ul class="more_con">
						<li><a href="#">收藏优购</a></li>
						<li><a href="#">帮助</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	
		
		
	{{if value="'CONTROLLER' neq 'Login' and 'CONTROLLER' neq 'Reg' and 'CONTROLLER' neq 'Order'"}}
	<!--LOGO,搜索，购物车-->
	<div class="site_header">
		<!--logo区域-->
		<div class="logo fl">
			<a class="block" href="{{U('Index/index')}}"></a>
		</div>
		<!--搜索区域-->
		<form class="search fl" action="" method="post">
			<input type="text" name="keyword" class="search_box fl" id="keyword" placeholder="请输入搜索关键词" />
			<input type="submit" class="search_btn fl" value="搜索"/>
		</form>
		<!--购物车-->
		<div class="mycart_nav fr">
			<a href="{{U('Cart/index')}}">
		    <div class="mycart_btn">
		        <div class="zs_left fl"></div>
		        <div class="zs_center fl">
		        	<div class="tip_left fl"></div>
		        	<div id="paymoney" class="text fl">购物车(<span id="pordcount">{{if value="$cartData['total_rows']"}}{{$cartData['total_rows']}}{{else}}0{{endif}}</span>)件</div>
		        	<div class="tip_right fl"></div>
		        </div>
		        <div class="zs_right fl"></div>
		    </div>
		    </a>
		    
		    <div id="shoppingcartContainer">
		    	
		    </div>
		    
    	</div>
		<!--公司名称-->
		<div class="company_name fr">
		香港上市公司百丽国际旗下购物网站
		</div>
		<!--热搜关键词-->
		<div class="search_hot">
			<a href="">2件￥199</a>
			|
			<a href="">跑步鞋</a>
			|
		</div>
	</div>
	<!--导航看-->
	<div class="category_nav">
		<div class="nav">
			<!--水平导航-->
			<div class="x_nav fr">
				<ul class="x_nav_list fl">
					{{foreach from="$cateData" value="$v"}}
					<li><a href="{{U('List/index',array('cid'=>$v['cid']))}}">{{$v['cname']}}</a></li>
					{{endforeach}}
				</ul>
				<ul class="x_nav_list fr">
					<li class="fr"><a href="">潮流馆</a></li>
					<li class="fr"><a href="">闪团</a></li>
					<li class="fr"><a href="">秒杀</a></li>
					<li class="fr"><a href="">会员中心</a></li>
				</ul>
			</div>
			<!--垂直导航-->
			<div class="y_nav fl">
				<div class="y_nav_all">
					<a href="{{U('List/index')}}">全部商品分类</a>
				</div>
				<!--垂直分类-->
				<div class='y_nav_list {{if value="'CONTROLLER' neq 'Index'"}}no_index{{endif}}'>
					<ul class="y_nav_all_list">
						
						
						
						{{foreach from="$cateData" value="$v"}}
						<li>
							<div class="nav_title">
								<i class="iconfont">&#xe603;</i>
								<h3>
									<a href="{{U('List/index',array('cid'=>$v['cid']))}}">{{$v['cname']}}</a>
								</h3>
							</div>
							<div class="nav_title_son">
								{{list from="$v['_data']" name="$vv" row='4'}}
								<a href="{{U('List/index',array('cid'=>$vv['cid']))}}">{{$vv['cname']}}</a>
								{{endlist}}
							</div>
							<div class="nav_menu">
								{{foreach from="$v['_data']" value="$vv"}}
								<div class="category">
									<div class="category_title">
										<a href="{{U('List/index',array('cid'=>$vv['cid']))}}">
											{{$vv['cname']}}
										</a>
									</div>
									<div class="category_ul">
										{{list from="$vv['_data']" name="$vvv" row='16'}}
										<a href="{{U('List/index',array('cid'=>$vvv['cid']))}}">{{$vvv['cname']}}</a>
										{{endlist}}
									</div>
								</div>
								{{endforeach}}
							</div>
						</li>
						{{endforeach}}
					</ul>
				</div>
			</div>
		</div>
	</div>
	{{endif}}
</div>

<script type="text/javascript">
	$(function(){
	$('.mycart_nav').hover(function(){
		$('#shoppingcartContainer').css({display:'block'});
		$.ajax({
			type:"post",
			url:cart,
			data:{status:1},
			dataType:'json',
			success:function(data){
				var str = '';
				var num = 0;
				$.each(data, function(k,v) {
					str +='<div class="goods"><table><tr style="border-bottom: 1px dotted #CCCCCC;"><td style="text-align: center;" width="60">';
		    		str +='<a href="#"><img style="width: 40px;height: 40px;" src="'+v.options.listpic+'"/></a></td><td width="240" style="padding-left: 6px;"><p>';
		    		str +='<a href="">'+v.name+'</a></p><p>';
		    		str +='颜色：<span>'+v.options.color+'</span>';
		    		str +='&nbsp;&nbsp;&nbsp;&nbsp;'
		    		str +='尺寸：<span>'+v.options.size+'</span></p></td><td width="60">';
		    		str +='<span>￥'+v.total+'</span></td><td class="change_num" width="60">';
					str +='数量：'+v.num+'</td></tr></table></div>';
		    		num++;
				});
				str +='<div class="count">';
				str +='<p class="fl">共<span>' + num +'</span>件商品</p>';
		    	str +='<a class="btn fr" href="{{U('Cart/index')}}">去购物车结算</a></div>';
		    		
				
				$('#shoppingcartContainer').html(str);
			}
		});
	},function(){
		$('#shoppingcartContainer').css({display:'none'});
	})
})

</script>













